# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Maintainer: Leonardo Arena <rnalrd@alpinelinux.org>
pkgname=umurmur
pkgver=0.2.20
pkgrel=6
pkgdesc="Minimalistic Mumble server primarily targeted to run on routers"
url="https://umurmur.net/"
arch="all"
license="BSD-3-Clause"
options="!check" # no test suite
makedepends="libconfig-dev openssl-dev>3 protobuf-c-dev autoconf automake"
install="$pkgname.post-install"
subpackages="$pkgname-openrc $pkgname-doc"
pkgusers="umurmur"
pkggroups="umurmur"
source="$pkgname-$pkgver.tar.gz::https://github.com/umurmur/umurmur/archive/$pkgver.tar.gz
	remove-crypto-mem-ctrl.patch

	https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/ports/audio/umurmur/files/umurmurd.8?rev=1.1
	https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/ports/audio/umurmur/files/umurmur.conf.5?rev=1.1

	$pkgname.initd
	$pkgname.confd
	$pkgname.conf"

prepare() {
	default_prepare
	autoreconf -fi
}

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		--with-ssl=openssl
	make
}

package() {
	make DESTDIR="$pkgdir" install
	install -Dm644 "$srcdir"/$pkgname.conf "$pkgdir"/etc/$pkgname/umurmurd.conf

	install -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
	install -Dm644 "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname

	install -Dm644 "$srcdir/umurmurd.8?rev=1.1" "$pkgdir/usr/share/man/man1/umurmurd.8"
	install -Dm644 "$srcdir/umurmur.conf.5?rev=1.1" "$pkgdir/usr/share/man/man1/umurmur.conf.5"
}

sha512sums="
0913f5ba84b30fec4ae6a1521c442ff8c48121bbbca5de9082e04e41b36434fadb5f81cb2ea0bd0a8c63f6e541d15eeda3637667d8cc7113d38935ded320cef4  umurmur-0.2.20.tar.gz
27ae0f9191f252313c10cde7ad1b89920e60279b219cc491c9b8280341c77740413c5287a0d94fc96e2a340ea3a4c0af78965b66cb4d8e86fdb55e83c69fedee  remove-crypto-mem-ctrl.patch
b825c94d4b3e2565f98f91fe92c7c81651a087573426fc29d0cdc5d54526dc4cab6ebf5b9fdde818b0f0f22eacec41350d7309a04938b805291ce90595ece203  umurmurd.8?rev=1.1
d91c5d4a5a1c9b2edbfeaf8cb398d1e7e6c97f11dfa1c129cfdf42fb58fad9bb20929276cb98b5ef930a9bad40785d35553dc000053732155c2fe7312d56a4f5  umurmur.conf.5?rev=1.1
0426bc25ae262712b5173ddb53a14257a12ea4794641169ebd4dc154a2f474511d8e03303669d4742e56d0f971d3c20fae9667283f729644b2f09c2dd234b19f  umurmur.initd
ea5d4826d270f174b23ef4101586ffa3c6ba3311bc443595288dc1839f4127f5fa4bf64f9469037a2f947e3ddd22ac1895326db0fdd4122980d3fcaa0536621e  umurmur.confd
0a5882dca2daf686716d7b78f916e4506c7b98e3460ccd56aace087dca88b686b659e32b325bf253922cc824049a800b06e5006ea04cc5539c82b63cda5cccea  umurmur.conf
"
